﻿package net.pezzato.grpbannr{
	import flash.display.Sprite;
	import flash.display.Graphics;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFormat;
	public class Label extends Sprite {
		private var tField_:TextField;
		private var border_:Sprite;
		public function Label(text:String){
			drawText(text);
			drawBorder();
			addChild(border_);
			addChild(tField_);
		}
		private function drawText(text:String) {
			tField_ = new TextField();
			var tFormat:TextFormat = new TextFormat();
			tFormat.align = "left";
			tFormat.bold = true;
			tFormat.font = "Arial";
			tFormat.size = 20;
			tField_.autoSize = "left";
			tField_.defaultTextFormat = tFormat
			tField_.antiAliasType = AntiAliasType.ADVANCED;
			tField_.cacheAsBitmap = false;
			tField_.embedFonts = true;
			tField_.text = text;
			tField_.x = 5;
		}
		private function drawBorder() {
			border_ = new Sprite();
			border_.graphics.lineStyle(3, 0x000000, 1, true);
			border_.graphics.beginFill(0xffffff, 0.8);
			border_.graphics.drawRoundRect(0, 0, tField_.width + 10, tField_.height, 10, 10);
		}
	}
}